﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ExpenseReportLineControl.ascx.cs" Inherits="WebSiteAlex.ExpenseReportLineControl" %>

<%@ Register src="ControlExpenseLine.ascx" tagname="ControlExpenseLine" tagprefix="uc1" %>

<asp:Panel ID="listPanel" runat="server">
    <asp:LinqDataSource ID="source" runat="server" OnSelecting="OnLinqDataSourceSelecting">
    </asp:LinqDataSource>
    
    <asp:GridView ID="grid" runat="server" AutoGenerateColumns="False" EmptyDataText="No expense report lines to list." 
        DataKeyNames="Id" OnSelectedIndexChanged="OnSelected" AllowPaging="True" AllowSorting="True" 
        DataSourceID="source" Width="100%">
        <Columns>
            <asp:TemplateField>
                <ItemTemplate>
                    <asp:ImageButton ID="btnSelect" runat="server" CommandName="Select" 
                    ImageUrl="~/Images/Edit.gif" />
                </ItemTemplate>
            </asp:TemplateField>

            <asp:BoundField DataField="Description" HeaderText="Description" SortExpression="Description" />  
            <asp:BoundField DataField="Date" HeaderText="Date" SortExpression="Date" />  
            <asp:BoundField DataField="Value" HeaderText="Value" SortExpression="Value" />  
            <asp:TemplateField>
                <ItemTemplate>
                    <asp:ImageButton ID="btnDelete" runat="server" CommandName="Delete" ImageUrl="~/Images/Delete.jpg"
                        CommandArgument='<%# Eval("Id") %>' OnClick="OnDelete" OnClientClick='confirm("Are you sure?")' />
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
    </asp:GridView>
    <br />
    <asp:Button ID="btnNew" runat="server" Text="New Line" OnClick="OnNew" />
</asp:Panel>

<asp:Panel ID="editPanel" runat="server" Visible="false">
    <div style="border: solid 1px; width:100%; padding-left:10px">
        <b>Edit Expense Report Line</b>
        <br />
        <asp:Button ID="btnSave" runat="server" Text="Save" OnClick="OnSave" />
        <asp:Button ID="btnReturn" runat="server" Text="Back" OnClick="OnReturn" CausesValidation="false" />
        
        <br />
        
        <uc1:ControlExpenseLine ID="ControlExpenseLine1" runat="server" />
    </div>
</asp:Panel>
